
function test(data) {
    var modelName = getResponseModelName('#/definitions/BaseResponse');
    renderResponseModel(eval(data), modelName);
}

//渲染返回参数
function renderResponseModel(jsonData, modelName) {
    var value ;
    if (modelName) {
        var model = jsonData.definitions[modelName];
        model.name = modelName;
        //修改有嵌套对象的type
        $.each(model.properties, function (i, v) {
            if (v.items) {
                $.each(v.items, function (j, item) {
                    model.properties[i].type = v.type + "[" + getResponseModelName(item) + "]"
                });
            }
        });
        value += model;
        console.info(value);

        //递归渲染多层对象嵌套
        $.each(model.properties, function (i, v) {
            if (v.items) {
                $.each(v.items, function (j, item) {
                    value += renderResponseModel(jsonData, getResponseModelName(item));
                });
            }
        });
        console.info(value);
        return value;
    }
}

//获得返回模型名字
function getResponseModelName(val) {
    if (!val) {
        return null;
    }
    return val.substring(val.lastIndexOf("/") + 1, val.length);
}